package com.kaili.basic.controller.pda.v1;

import com.baomidou.mybatisplus.plugins.Page;
import com.kaili.basic.pojo.dto.BarcoderuleDto;
import com.kaili.basic.pojo.entity.BaseBarcodeRule;
import com.kaili.basic.service.IBaseBarcodeRuleService;
import com.kaili.basic.version.ApiVersion;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController("baseBarcodeRuleControllerPC")
@ApiVersion(1)
@RequestMapping("/{api_version}")
@Api(tags = "[pda]条码规则", description = "[pda]条码规则管理相关API")
public class BaseBarcodeRuleController {
    @Autowired
    IBaseBarcodeRuleService baseBarcodeRuleService;

    //根据条件分页查询条码规则
    @GetMapping(value = "p/barcoderules")
    @ApiOperation(value = "根据条件分页查询条码规则", notes = "根据条件分页查询条码规则")
    public Page<BaseBarcodeRule> queryPagedList(@ModelAttribute BarcoderuleDto barcoderuleDto) {
        BaseBarcodeRule baseBarcodeRule = new BaseBarcodeRule();
        BeanUtils.copyProperties(barcoderuleDto, baseBarcodeRule);
        Page<BaseBarcodeRule> base = baseBarcodeRuleService.queryPagedList(new Page<BaseBarcodeRule>(baseBarcodeRule.getPage(), baseBarcodeRule.getPageSize()), baseBarcodeRule);
        return base;
    }

}
